<?php if ( ! defined('ABS_PATH')) exit('ABS_PATH is not loaded. Direct access is not allowed.');

  

    abstract class BaseModel
    {
        //action to execute
        protected $action ;

        function  __construct()
        {
            // Moved Session start to oc-load to be able to use it on index.php
            // Session::newInstance()->session_start() ;
            $this->action = Params::getParam('action') ;
        }

        //to export variables at the business layer
        function _exportVariableToView($key, $value)
        {
            View::newInstance()->_exportVariableToView($key, $value) ;
        }

        //only for debug (deprecated, all inside View.php)
        function _view($key = null)
        {
            View::newInstance()->_view($key) ;
        }

        //Funciones que se tendran que reescribir en la clase que extienda de esta
        protected abstract function doModel() ;
        protected abstract function doView($file) ;

        function do404()
        {
            Rewrite::newInstance()->set_location('error');
            header('HTTP/1.1 404 Not Found') ;
            osc_current_web_theme_path('404.php') ;
        }

        function redirectTo($url)
        {
            header('Location: ' . $url) ;
            exit ;
        }
    }

?>